package qj.ps;

public class DeclareMapMain {
	public static void main(String[] args) {
//		String str = "{accountId=498987878819, identityID=MondrianToERFacade, applicationID=OpCoApiDE, serviceInterfaceVersion=1.4, referenceID=57b36b9e-14b0-48d6-857f-784a33c555eb, opcoSubscriptionID=, requestID=57b36b9e-14b0-48d6-857f-784a33c555eb, serviceID=OrderService, opcoID=26202, partnerID=CBS, opcoCustomerID=498987878819, channel=11}";
		String str = "[AccountType, C, ParentGroupID, ??, DesktopLicenses, 1, DesktopLicencesGbAlloc, 11]";
		if (str.startsWith("{")) {
			declareMap(str);
		} else {
			declareList(str);
		}
	}

	private static void declareList(String str) {
		str = str.substring(1, str.length() -1);

		String[] split1 = str.split(",\\s*");
		for (int i = 0; i < split1.length; i+=2) {
			System.out.println("\"" + split1[i] + "\", \"" + split1[i + 1] + "\",");
		}
	}

	public static void declareMap(String str) {
		str = str.substring(1, str.length() -1);
		
		for (String string : str.split(",\\s*")) {
			String[] split = string.split("=");
			
			String val = "";
			if (split.length>1) {
				val = split[1];
			}
			System.out.println("\"" + split[0] + "\", \"" + val + "\",");
		}
	}
}
